package com.hmz.backend.utils;


import cn.hutool.crypto.symmetric.SymmetricAlgorithm;
import cn.hutool.crypto.symmetric.SymmetricCrypto;
import org.springframework.stereotype.Component;


public class PasswordEncoder {
    //密钥
    private static byte[] key = "2b7e151628aed2a6abf7158809cf4f3c".getBytes();
    //构建
    private static SymmetricCrypto aes = new SymmetricCrypto(SymmetricAlgorithm.AES, key);

    public static String encode(String content){
        return aes.encryptHex(content);
    }
    public static String uncode(String encode){
        return aes.decryptStr(encode);
    }

    public static String getToken(int id,String permission){
        return encode(permission+id);
    }
}
